package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展会相关企业
 * </p>
 *
 * @author dq
 * @date 2022-09-28
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionCompanyCompanySourceEnum", description = "公司来源 #{SYSTEM_OPERATE:系统维护;MANUAL_OPERATE:手动录入-枚举")
public enum ExhibitionCompanyCompanySourceEnum implements BaseEnum {

    /**
     * SYSTEM_OPERATE="系统维护"
     */
    SYSTEM_OPERATE("系统维护"),
    /**
     * MANUAL_OPERATE="手动录入"
     */
    MANUAL_OPERATE("手动录入"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionCompanyCompanySourceEnum match(String val, ExhibitionCompanyCompanySourceEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionCompanyCompanySourceEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionCompanyCompanySourceEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SYSTEM_OPERATE,MANUAL_OPERATE", example = "SYSTEM_OPERATE")
    public String getCode() {
        return this.name();
    }

}
